#include "MainWindow.h"
#include "../../Scene/BattleScene.h"
using namespace cocos2d;
using namespace storm;


PANEL_SHOW_FUN_CPP(MainWindow)
void MainWindow::onEnter()
{
	UIPanel::onEnter();
	s_pInstance = this;

	float x, y;
	for(int i=0; i<4; i++)
	{
		UIButton *pBtn = UIButton::Create(CSTR(ResPathMainUI + "main_a01.png"));
		AddChildWidget(pBtn);
		pBtn->SetScaleFactor(1.1f);
		x = (i % 2 == 0) ? 250 : 540;
		y = i > 1 ? 380 : 250;
		pBtn->setPosition(ccpAdjustRes(x, y));
		pBtn->OnClick.connect(this, &MainWindow::OnMainButton);
	}
}

void MainWindow::OnMainButton(UIButton *pSender)
{
	BattleScene::Show();
}